Using Euclids Extended Algorithm:
Calculate x and y in Bézout's Identity
using (5,1001)
For 2 numbers a and b and divisor d:
ax + by = d
a math | a | b math | b | d math | d | k math | k |
---|---|---|---|---|---|---|---|
Set to 1 | 1 | Set to 0 | 0 | 5 | |||
Set to 0 | 0 | Set to 1 | 1 | 1001 | Quotient of 5/1001 | 0 | |
1 - (0 x 0) | 1 | 0 - (0 x 1) | 0 | Remainder of 5/1001 | 5 | Quotient of 1001/5 | 200 |
0 - (200 x 1) | -200 | 1 - (200 x 0) | 1 | Remainder of 1001/5 | 1 | Quotient of 5/1 | 5 |
1 - (5 x -200) | 1001 | 0 - (5 x 1) | -5 | Remainder of 5/1 | 0 | Quotient of 1/0 | 0 |
a = -200 and b = 1
ax + by = gcd(a,b)
5x + 1001y = gcd(5